package main

import (
	"encoding/json"
	"fmt"
	"sort" // sort.Ints()
)

func numFriendRequests(ages []int) (ans int) {
	sort.Ints(ages)
	left, right := 0, 0
	for _, age := range ages {
		if age < 15 {
			continue
		}
		for ages[left] * 2 <= age + 14 {
			left++
		}
		for right + 1 < len(ages) && ages[right+1] <= age {
			right++
		}
		ans += right - left
	}
	return
}


func main() {
	var agesString string
	if _, err := fmt.Scanf("%s", &agesString); err != nil {
		println("err: ", err)
		return
	}

	ages := make([]int, 0)
	if agesJsonErr := json.Unmarshal([]byte(agesString), &ages); agesJsonErr != nil {
		println("agesJsonErr: ", agesJsonErr)
		return
	}

	println(numFriendRequests(ages))
}